import { IFeidaoAiBrowserComponent } from '@feidao/web/interfaces';
import a002 from './a002';
/**
 * 左列表复选框点击事件
 */
export default async function (fd: IFeidaoAiBrowserComponent, ...args: any[]) {

	const lefts = document.querySelectorAll<HTMLInputElement>('[data-feidao-department_no]');
	const department_nos = Array.from(lefts).filter((n) => {
		return n.checked;
	}).map((_n) => {
		return _n.dataset.feidaoDepartment_no;
	});

	console.log(department_nos);

	if (department_nos.length > 0) {
		fd.data.criteria = {
			$or: department_nos.map((n) => {
				return { department_no: n }
			})
		};
	} else {
		fd.data.criteria = {};
	}

	fd.data.page_size = 20;
	fd.data.page_no = 1;
	fd.data.asc = ['exam_subjects_id'];

	a002(fd);
}
